<template>
	<view class="page-body">
		<view class="page-section page-section-gap">
			<web-view :src="url" @message="loading"></web-view>
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				url : '',
				op : 'list',
				keyword : '',
				type : 0,
				cate : 0,
				statu : 0,
				page : 1
			}
		},
		onLoad(e){
			this.keyword = e.keyword
			this.type = e.type ? Number(e.type) : 0
			this.page = e.page ? Number(e.page) : 1
			this.cate = e.cate ? Number(e.cate) : 0
			this.statu = e.statu ? Number(e.statu) : 0
			this.url = getApp().globalData.siteInfo.siteroot + '?i='+getApp().globalData.siteInfo.uniacid+'&c=entry&a=toutiaoapp&m=zk_tm&do=api&path=search/create&key='+uni.getStorageSync('token')
			+'&data='+JSON.stringify({type:this.type,keyword:encodeURIComponent(this.keyword),cate:this.cate,statu:this.statu,page:this.page})
		},
		methods: {
			loading(e) {
				let data = e.detail.data[0]
				if(data.length > 0){
					uni.setStorageSync('hasMore',true)
				}else{
					uni.setStorageSync('hasMore',false)
				}
				if(this.page > 1){
					let list = uni.getStorageSync('list')
					list = list.concat(data)
					uni.setStorageSync('list',list)
				}else{
					uni.setStorageSync('list',data)
				}
			}
		}
	}
</script>

<style>
	
</style>